/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mabi.modular.runtime.application;

import com.mabi.modular.install.modules.IModuleDefinition;
import com.mabi.modular.runtime.module.RuntimeMabiModule;
import com.mabi.modular.runtime.module.contributions.actions.AbstractMabiAction;
import com.mabi.modular.runtime.module.contributions.menus.Menu;
import com.mabi.modular.runtime.module.contributions.toolbars.Toolbar;
import com.mabi.modular.runtime.module.contributions.toolbars.ToolbarItem;
import com.mabi.modular.runtime.module.contributions.views.ViewImpl;
import com.mabi.modular.runtime.module.contributions.zones.Zone;
import com.vaadin.terminal.ParameterHandler;
import com.vaadin.ui.Component;
import com.vaadin.ui.Component.Listener;
import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.TabSheet;
import java.util.List;
import java.util.Map;

/**
 *
 * @author User
 */
public interface IFrontEndApp extends IApplication {
    String CENTER_SUB_ZONE = "center";
    String CENTER_ZONE = "center";
    String EAST_SUB_ZONE = "east";
    String FOOTER_SUB_ZONE = "footersz";
    String FOOTER_ZONE = "footer";
    String HEADER_SUB_ZONE = "header";
    String HEADER_ZONE = "header";
    String SOUTH_SUB_ZONE = "south";
    String WEST_SUB_ZONE = "west";

    void addMenuBar(Menu menu);

    /**
     * Adds a menu item under the parent menu item. If parent is null, the item
     * will be added in the menu bar.
     * @param menuItem
     * @param parentItem
     */
    void addMenuItem(MenuItem menuItem, int position, MenuItem parentItem);

    void addParameterProcessor(ParameterHandler handler);

    void addStatusBarComponent(Component component, String statusBarZone, int position);

    void addSystemMenuItem(MenuItem menuItem);

    void addSystemToolsComponent(Component component, int position);

    void addToolbar(Toolbar toolbar);

    void addToolbarItem(ToolbarItem toolbarItem, int position);

    void addView(ViewImpl view) throws Exception;

    void addView(ViewImpl view, String zoneName) throws Exception;

    void addZone(String legalZoneName);

    void addZone(Zone zone, String parentZone, boolean showHead);

    void attachZone(Zone zone, Zone parentZone, int position);

    void blockApplication(String message, boolean desktopVisible);

    void detachZone(Zone zone);

    void disableMenuItem(MenuItem menuItem, String description);

    void disableSystemToolsComponent(Component component, String disabledText);

    void disableToolbarItem(ToolbarItem toolbarItem);

    void enableMenuItem(MenuItem menuItem);

    void enableSystemToolsComponent(Component component);

    void enableToolbarItem(ToolbarItem toolbarItem);

    void executeAction(AbstractMabiAction action);

    void executeMenuItem(MenuItem menuItem);

    void executeToolbarItem(ToolbarItem toolbarItem);

    TabSheet getViewContainer(String viewContainerZoneName) throws Exception;

    void init();

    void jumpView(String viewCaption, int position);

    void moveAllZoneContent(Zone zone, Zone destinationZone);

    void moveToolbarItem(ToolbarItem toolbarItem, int newPosition, Toolbar toolbar);

    void moveView();

    void moveZone(Zone zone, Zone newParentZone);

    void remarkMenuItem(MenuItem menuItem, String bubbleText, int timeout);

    void remarkSystemToolsComponent(Component component, String remarkText, int timeout);

    void remarkToolbar(Toolbar toolbar, String bubbleText, int timeout);

    void remarkView(ViewImpl view, String remakText, int timeout);

    void removeMenu(Menu menu);

    void removeMenuItem(MenuItem menuItem);

    void removeStatusBarComponent(Component component);

    void removeSystemToolsComponent(Component component);

    void removeToolbar(Toolbar toolbar);

    void removeToolbarItem(ToolbarItem toolbarItem);

    void removeView(ViewImpl view) throws Exception;

    void removeZone(Zone zone);

    void replaceMenuItem(MenuItem oldMenuItem, MenuItem newMenuItem);

    void replaceToolbarItem(ToolbarItem oldToolbarItem, ToolbarItem newToolbarItem);

    /**
     * Presents a progress bar on the status bar for finite running processes
     * @param label
     * @param stopListener
     * @param status
     */
    void runBackGroundProcess(String label, Listener stopListener, int status);

    /**
     * Presents a progress bar on the status bar for undefined running processes
     * @param label
     * @param stopListener
     */
    void runBackGroundProcess(String label, Listener stopListener);

    void selectSubView(String viewCaption, String subViewCaption);

    void selectView(String viewCaption);

    void setAppCaption(String caption);

    void setStatusText(String statusBarText);

    void showSplash(int timeOut);

    void unBlockApplication();
    
    public Map<String, Object> getAppContext();
    
    public void setAppContext(Map<String, Object> appContext);
    
    public void setContextItem(String itemName, Object itemValue);
    
    public RuntimeMabiModule getLoadedModule(String moduleName);
    
    public List<RuntimeMabiModule> getLoadedModules();
    
    public void loadModule(RuntimeMabiModule module);
    
    public void unLoadModule(RuntimeMabiModule module);
    
}
